using System;
using System.Collections.Generic;
using System.Text;
using WCFDicing.BusinessEntities;
using WCFDicing.DataAccess;

namespace WCFDicing.BusinessLogic
{
    /// <summary>
    /// Klasa dostarczajaca funkcjonalnosci w obszarze zarzadzania
    /// danymi uzytkownikow kasyna (dodaj/edytuj/usun/wyswietl...)
    /// </summary>
    public class CasinoUsersManager
    {
        private String database;
        /// <summary>
        /// Connection-string do bazy danych
        /// </summary>
        public String Database
        {
            get { return database; }
            set { database = value; }
        }

        /// <summary>
        /// Konstruktor parametrowy managera
        /// </summary>
        /// <param name="database">Connection-string do bazy danych</param>
        public CasinoUsersManager( String database )
        {
            Database = database;
        }

        /// <summary>
        /// pobiera stan konta  gracza
        /// </summary>
        /// <param name="IdUser">id gracza, ktorego stan konta chcemy sprawdzic</param>
        /// <returns></returns>
        public CASINO_USER_MONEY GetUserMoney( int IdUser )
        {
            CASINO_USER_MONEYRepository rep = new CASINO_USER_MONEYRepository( database );
            return rep.GetPlayerMoney( IdUser );
        }

        /// <summary>
        /// aktualizuje stan konta gracza
        /// </summary>
        /// <param name="money">obiekt opisujacy stan konta i id gracza</param>
        public void UpdateUserMoney( CASINO_USER_MONEY money )
        {
            CASINO_USER_MONEYRepository rep = new CASINO_USER_MONEYRepository( database );
            rep.Save( money );
        }
    }
}
